|
EPD Extension Kit for MSP430 LaunchPad
|
The definition of flash memory. More...
#include "EPD_Kit_Tool_Process.h"Go to the source code of this file.
Classes | |
| struct | ASCII_info_t |
| The structure of ASCII input information. More... | |
Macros | |
| #define | _flash_sector_size (long)4*1024 |
| #define | _page_size_144_200 (long)_flash_sector_size*2 |
| #define | _page_size_270 (long)_flash_sector_size*3 |
| #define | _image_page_max 16 |
| #define | _flash_line_size 64 |
| #define | _image_page_mark ((uint8_t)(_image_page_max-1)) |
| #define | _image_header_mark_offset _flash_line_size-2 |
| #define | _image144_size 13 |
| #define | _image144_SOF (long)0x0000 |
| #define | _image144_address(x) _image144_SOF+((long)x<<_image144_size) |
| #define | _image144_mark_image_page_max 4 |
| #define | _image144_mark_image_SOF (long)(_image144_SOF+(_image_page_max*_page_size_144_200)) |
| #define | _image144_mark_image_address(x) _image144_mark_image_SOF+((long)x<<_image144_size) |
| #define | _image144_slideshow_page_max 4 |
| #define | _image144_slideshow_SOF |
| #define | _image144_slideshow_address(x) _image144_slideshow_SOF+((long)x<<_image144_size) |
| #define | _image144_custom_page_max 8 |
| #define | _image144_custom_SOF |
| #define | _image144_custom_address(x) _image144_custom_SOF+((long)x<<_image144_size) |
| #define | _image200_size 13 |
| #define | _image200_SOF |
| #define | _image200_address(x) _image200_SOF+((long)x<<_image200_size) |
| #define | _image200_mark_image_page_max 4 |
| #define | _image200_mark_image_SOF (long)_image200_SOF+(_image_page_max*_page_size_144_200) |
| #define | _image200_mark_image_address(x) _image200_mark_image_SOF+((long)x<<_image200_size) |
| #define | _image200_slideshow_page_max 4 |
| #define | _image200_slideshow_SOF |
| #define | _image200_slideshow_address(x) _image200_slideshow_SOF+((long)x<<_image200_size) |
| #define | _image200_custom_page_max 8 |
| #define | _image200_custom_SOF |
| #define | _image200_custom_address(x) _image200_custom_SOF+((long)x<<_image200_size) |
| #define | _image270_SOF |
| #define | _image270_address(x) _image270_SOF + (((long)x<<13)+((long)x<<12)) |
| #define | _image270_mark_image_page_max 4 |
| #define | _image270_mark_image_SOF (long)_image270_SOF+(_image_page_max*_page_size_270) |
| #define | _image270_mark_image_address(x) _image270_mark_image_SOF +(((long)x<<13)+((long)x<<12)) |
| #define | _image270_slideshow_page_max 4 |
| #define | _image270_slideshow_SOF |
| #define | _image270_slideshow_address(x) _image270_slideshow_SOF +(((long)x<<13)+((long)x<<12)) |
| #define | _image270_custom_page_max 8 |
| #define | _image270_custom_SOF |
| #define | _image270_custom_address(x) _image270_custom_SOF +(((long)x<<13)+((long)x<<12)) |
| #define | _parameters_address 0xFF000 |
| #define | _parameters_address_max 0xFFFF0 |
| #define | _image_state_in_use 0xAF |
| #define | _image_state_is_empty 0xFF |
| #define | _NULL_address -1 |
| #define | __ASCII_OFFSET 0x20 |
| #define | __TEXT_Width 8 |
| #define | __TEXT_High 8 |
| #define | ElectronicID 0x13 |
| #define | FLASH_CMD_RDID 0x9F |
| #define | FLASH_CMD_RES 0xAB |
| #define | FLASH_CMD_REMS 0x90 |
| #define | FLASH_CMD_WRSR 0x01 |
| #define | FLASH_CMD_RDSR 0x05 |
| #define | FLASH_CMD_READ 0x03 |
| #define | FLASH_CMD_FASTREAD 0x0B |
| #define | FLASH_CMD_WREN 0x06 |
| #define | FLASH_CMD_WRDI 0x04 |
| #define | FLASH_CMD_PP 0x02 |
| #define | FLASH_CMD_SE 0x20 |
| #define | FLASH_CMD_BE 0xD8 |
| #define | FLASH_CMD_CE 0x60 |
| #define | FLASH_CMD_DP 0xB9 |
| #define | FLASH_CMD_RDP 0xAB |
| #define | FLASH_WIP_MASK 0x01 |
| #define | FLASH_LDSO_MASK 0x02 |
| #define | FLASH_QE_MASK 0x40 |
Functions | |
| uint8_t | is_flash_existed (void) |
| Check the flash memory of EPD extension board is existed or not in order to determine the board is connected. More... | |
| void | Flash_cs_high (void) |
| Set Flash_CS pin to high and EPD_CS to low. | |
| void | Flash_cs_low (void) |
| Set EPD_CS to high and Flash_CS to low. | |
| void | CMD_SE (long flash_address) |
| Erase the data of the chosen sector (4KB) to be "1". More... | |
| void | CMD_CE (void) |
| Erase all of the flash memory. | |
| void | Flash_init (void) |
| void | read_flash (long Address, uint8_t *target_address, uint8_t byte_length) |
| Read Flash data into buffer. More... | |
| void | write_flash (long Address, uint8_t *source_address, uint8_t byte_length) |
| Write Flash data from buffer. More... | |
| void | erase_image (long address, uint8_t ptype) |
| To erase the image data. More... | |
| void | get_flash_image_info (image_information_t *ImageInfo) |
| Get image information from flash. More... | |
| long | get_flash_mark_image_info (uint8_t PlaneType) |
| Get mark image information from flash. More... | |
| long | get_custom_image_address (uint8_t PlaneType, uint8_t ImageIdx, uint8_t IsClear) |
| Get the custom image address and clear the image or not. More... | |
| long | get_slideshow_image_address (uint8_t PlaneType, uint8_t ImageIdx, uint8_t IsClear) |
| Get the slideshow image address and clear the image or not. More... | |
| void | write_mark (long address) |
| Write image header to flash. More... | |
| void | Readtest (void) |
| void | write_ascii (long CanvasAddress, long MarkAddress, uint16_t LocationX, uint16_t LocationY, char *Text) |
| Write ASCII data to canvas image of flash. More... | |
| void | read_slideshow_parameters (slideshow_information_t *SlideshowInfo) |
| Read slideshow parameters from defined Flash segment. More... | |
| void | write_slideshow_parameters (slideshow_information_t *SlideshowInfo) |
| Update slideshow parameters. More... | |
The definition of flash memory.
Copyright (c) 2012-2013 Pervasive Displays Inc. All rights reserved.
Authors: Pervasive Displays Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define __TEXT_Width 8 |
The predefined ASCII character is 8*8
| #define _flash_sector_size (long)4*1024 |
Flash map
| #define _image144_custom_page_max 8 |
Segment B: 0x30000~0x3FFFF, 8 pages of custom image
| #define _image144_custom_SOF |
| #define _image144_mark_image_page_max 4 |
Segment B: 0x20000~0x27FFF, 4 pages of marked image
| #define _image144_size 13 |
1.44" Flash Map *********************************************************** Segment A: 0x00000~0x1FFFF, 16 pages of 1.44" image 1.44" resolution=128*96, 128=16bytes. 96*64=6K, allocate 8K (64=_flash_line_size)
| #define _image144_slideshow_page_max 4 |
Segment B: 0x28000~0x2FFFF, 4 pages of slideshow image
| #define _image144_slideshow_SOF |
| #define _image200_custom_page_max 8 |
Segment B: 0x70000~0x7FFFF, 8 pages of custom image
| #define _image200_custom_SOF |
| #define _image200_mark_image_page_max 4 |
Segment B: 0x60000~0x67FFF, 4 pages of marked image
| #define _image200_size 13 |
2" Flash Map ************************************************************** Segment A: 0x40000~0x5FFFF, 16 pages of 2" image 2" resolution=200*96, 200=25bytes. 96*64=6K, allocate 8K (64=_flash_line_size)
| #define _image200_slideshow_page_max 4 |
Segment B: 0x68000~0x6FFFF, 4 pages of slideshow image
| #define _image200_slideshow_SOF |
| #define _image200_SOF |
| #define _image270_custom_page_max 8 |
Segment B: 0xC8000~0xCFFFF, 8 pages of custom image
| #define _image270_custom_SOF |
| #define _image270_mark_image_page_max 4 |
Segment B: 0xB0000~0xBBFFF, 4 pages of marked image
| #define _image270_slideshow_page_max 4 |
Segment B: 0xBC000~0xC7FFF, 4 pages of slideshow image
| #define _image270_slideshow_SOF |
| #define _image270_SOF |
2.7" Flash Map ************************************************************** Segment A: 0x80000~0xAFFFF, 16 pages of 2.7" image 2.7" resolution=264*176, 264=33bytes. 176*64=11K, allocate 12K (64=_flash_line_size)
| #define _image_header_mark_offset _flash_line_size-2 |
the last two bytes of first flash line to flag the image state
| #define _image_page_mark ((uint8_t)(_image_page_max-1)) |
the last page if using mark image for partial update
| #define _parameters_address 0xFF000 |
The slideshow parameters are stored at flash segment starts from 0xFF000 to 0xFFFF0
| #define ElectronicID 0x13 |
The Flash MX25 series command hex code definition
| #define FLASH_CMD_DP 0xB9 |
Mode setting commands
| #define FLASH_CMD_RDID 0x9F |
ID commands
| #define FLASH_CMD_READ 0x03 |
READ commands
| #define FLASH_CMD_SE 0x20 |
Erase commands
| #define FLASH_CMD_WREN 0x06 |
Program commands
| #define FLASH_CMD_WRSR 0x01 |
Register commands
| #define FLASH_WIP_MASK 0x01 |
status register
| void CMD_SE | ( | long | flash_address | ) |
Erase the data of the chosen sector (4KB) to be "1".
| flash_address | 32 bit flash memory address |
| void erase_image | ( | long | address, |
| uint8_t | EPD_size | ||
| ) |
To erase the image data.
| address | The start address to be erased |
| EPD_size | The EPD size |
| long get_custom_image_address | ( | uint8_t | EPD_size, |
| uint8_t | image_index, | ||
| uint8_t | is_clear | ||
| ) |
Get the custom image address and clear the image or not.
| EPD_size | The EPD size |
| image_index | The current image index to show |
| is_clear | Whether to clear custom images |
number of maximum custom images = 8
To erase custom image
| void get_flash_image_info | ( | image_information_t * | image_info | ) |
Get image information from flash.
| image_info | The data structure of image information |
| long get_flash_mark_image_info | ( | uint8_t | EPD_size | ) |
Get mark image information from flash.
| EPD_size | The EPD size |
| long get_slideshow_image_address | ( | uint8_t | EPD_size, |
| uint8_t | image_index, | ||
| uint8_t | is_clear | ||
| ) |
Get the slideshow image address and clear the image or not.
| EPD_size | The EPD size |
| image_index | The current image index to show |
| is_clear | Whether to clear slideshow images |
number of maximum slideshow images = 4
To erase slideshow image
Read image mark offset byte to IsExit
| uint8_t is_flash_existed | ( | void | ) |
Check the flash memory of EPD extension board is existed or not in order to determine the board is connected.
Chip select go low to start a flash command
Send command to check the Electronic ID of Flash
Chip select go high to end a flash command
| void read_flash | ( | long | flash_address, |
| uint8_t * | target_buffer, | ||
| uint8_t | byte_length | ||
| ) |
Read Flash data into buffer.
| flash_address | The start address of Flash |
| target_buffer | The target address of buffer will be read |
| byte_length | The data length will be read |
| void read_slideshow_parameters | ( | slideshow_information_t * | slideshow_info | ) |
Read slideshow parameters from defined Flash segment.
| slideshow_info | The structure of slideshow information |
Read parameters from address
< Do while the data byte is empty
< Forward two data length is the last saved position of parameter address
| void write_ascii | ( | long | canvas_address, |
| long | mark_address, | ||
| uint16_t | coordinate_X, | ||
| uint16_t | coordinate_Y, | ||
| char * | Text | ||
| ) |
Write ASCII data to canvas image of flash.
| canvas_address | The canvas image address |
| mark_address | The mark image address |
| coordinate_X | The location of horizontal of inputted string |
| coordinate_Y | The location of vertical of inputted string |
| Text | The pointer of inputted string |
Get mark and canvas image address
Get ASCII character data and save to Text_array
write Text_array to Canvas memory
write mark memory
| void write_flash | ( | long | flash_address, |
| uint8_t * | source_address, | ||
| uint8_t | byte_length | ||
| ) |
Write Flash data from buffer.
| flash_address | 32 bit flash memory address |
| source_address | The source address of buffer will be written |
| byte_length | The data length will be read |
| void write_mark | ( | long | address | ) |
Write image header to flash.
| address | The image address |
| void write_slideshow_parameters | ( | slideshow_information_t * | slideshow_info | ) |
Update slideshow parameters.
| slideshow_info | The pointer address of slideshow information |
1.8.3.1